<div ng-if="pagedata.op=='copy'">
<img src="../core/resource/images/timg.jpg" style="width:100%">
</div>
<div ng-if="pagedata.op=='pay'" class='fui-page fui-page-current order-pay-page'>
    <div class="fui-header">
         <div class="title" >支付订单</div>
    </div>
    <div class='fui-content margin'>
        <div class="fui-cell-group">
            <div class="fui-cell">
                <div class="fui-cell-label">支付单号</div>
                <div class="fui-cell-info">{{pagedata.tid}}</div>
            </div>
            <div class="fui-cell">
                <div class="fui-cell-label">订单金额</div>
                <div class="fui-cell-info"><span class='text-danger'>￥{{pagedata.fee}}</span></div>
            </div>
        </div>
        <div class='fui-list-group' style="margin-top:10px;">
			<a ng-show="pagedata.fee == 0" class="btn btn-success block" href="javascript:" ng-click="pagedata.pay('credit')">确认支付</a>
			<div ng-show="pagedata.fee>0">
				<div class='fui-list pay-btn' ng-show="in_array('credit',pagedata.pay_types)" ng-click="pagedata.pay('credit')">
					<div class='fui-list-media'>
						<i class="icon jinyunicon icon-caifua credit"></i>
					</div>
					<div class='fui-list-inner'>
						<div class="title">余额支付</div>
						<div class="subtitle">当前账户余额: <span class='text-danger'>￥{{pagedata.credit}}</span>
						</div>
					</div>
					<div class='fui-list-angle'><span class="angle"></span></div>
				</div>
				<div class='fui-list pay-btn' ng-show="in_array('wechat',pagedata.pay_types)" ng-click="pagedata.pay('wechat')">
					<div class='fui-list-media'>
						<i class='icon icon-weixin1 wechat'></i>
					</div>
					<div class='fui-list-inner'>
						<div class="title">微信支付</div>
						<div class="subtitle">微信安全支付</div>
					</div>
					<div class='fui-list-angle'><span class="angle"></span></div>
				</div>
				<div class='fui-list pay-btn' ng-show="pagedata.isalipay_url!=1 && in_array('alipay',pagedata.pay_types)" ng-click="pagedata.pay('alipay')">
					<div class='fui-list-media'>
						<i class='icon icon-qianbaopengyou wechat'></i>
					</div>
					<div class='fui-list-inner'>
						<div class="title">支付宝支付</div>
						
					</div>
					<div class='fui-list-angle'><span class="angle"></span></div>
				</div>
				<div class='fui-list pay-btn' ng-show="pagedata.isalipay_url==1" ng-click="pagedata.pay('alipay_url')">
					<div class='fui-list-media'>
						<i class='icon icon-qianbaopengyou wechat'></i>
					</div>
					<div class='fui-list-inner'>
						<div class="title">支付宝支付</div>
					</div>
					<div class='fui-list-angle'><span class="angle"></span></div>
				</div>
			</div>
         </div>
    </div>
</div>
<div ng-if="pagedata.op=='diypay'" class='fui-page fui-page-current order-pay-page'>
	<style>
	.fui-cell-group .fui-cell:before {
		border-top: 0 solid #ebebeb;;
	}
	.text-danger {
		color: #00c568;
	}
	.btn.btn-success {
		background: #00c568;
	}
	</style>
    <div class='fui-content margin' style="background:#fff">
        <div class='fui-cell-group' style="margin-top:0;">
				<div class='fui-cell'>
					<div class='fui-cell-icon' style="width:auto">
						<i class="icon icon-caifub" style="font-size:1.6rem;color:#00c568"></i>
					</div>
					<div class='fui-cell-text'>
						<div class="title">{{pagedata.diypay_title||'核销支付'}} 
						<span ng-click="pagedata.pay()" class="label label-primary">点击切换支付方式</span>
						</div>
						<div class="text" style="color:red">{{pagedata.diypay_desc}}</div>
					</div>
				</div>
				<div ng-if="pagedata.diypay_code==1" class="fui-cell sm">
					<div class="fui-cell-label" style="color:red">收款用户名</div>
					<div class="fui-cell-info" style="color:red">{{pagedata.diypay_name}}</div>
					<div class="fui-cell-remark noremark" ng-click="tool.clip(pagedata.diypay_name)"><span class="label label-primary">复制</span></div>
				</div>
				<div ng-if="pagedata.diypay_code==1" class="fui-cell sm">
					<div class="fui-cell-label" style="color:red">收款账号</div>
					<div class="fui-cell-info" style="color:red">{{pagedata.diypay_number}}</div>
					<div class="fui-cell-remark noremark" ng-click="tool.clip(pagedata.diypay_number)"><span class="label label-primary">复制</span></div>
				</div>
				<div class="fui-cell sm">
					<div class="fui-cell-label">订单号</div>
					<div class="fui-cell-info">{{pagedata.ordersn}}</div>
					<div class="fui-cell-remark noremark" ng-click="tool.clip(pagedata.ordersn)"><span class="label label-primary">复制</span></div>
				</div>
				<div ng-if="pagedata.di_fee>0" class="fui-cell sm">
					<div class="fui-cell-label">抵扣金额</div>
					<div class="fui-cell-info">
					<span class='text-danger'>￥{{pagedata.di_fee}}</span>
					</div>
				</div>
				<div class="fui-cell sm">
					<div class="fui-cell-label">待付金额</div>
					<div class="fui-cell-info">
					<span class='text-danger'>￥{{pagedata.fee}}</span>
					<span ng-if="pagedata.oldfee>0" style="color:red;margin-left:0.2rem"><span style="font-size:0.6rem">原价￥</span>{{pagedata.oldfee}}</span>
					</div>
				</div>
         </div>
		<div ng-include="sys_html('common/_diyform')"></div>
		<a class="btn btn-success block" href="javascript:" ng-click="pagedata.submit(pagedata.post,'/member.pay/diypay/')">确认提交</a>
    </div>
</div>
<script>
scope.pagedata.pay=function(type){
	scope.tool.pay(scope.pagedata.id,function(res){
		scope.message(res.message,'success',scope.pagedata.forward_url);
	},type,'',scope.pagedata.success_url);
}
scope.pagedata.submit=function(post,post_url){
	var str = /^[1][3,4,5,7,8][0-9]{9}$///手机
    var strname =  /^[\u4e00-\u9fa5]+(·[\u4e00-\u9fa5]+)*$/ //中文
    var stremail = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
    var filedata = scope.pagedata.post.diyfields?scope.pagedata.post.diyfields:[]
	for (var i=0;i<filedata.length;i++){
		if((filedata[i].ismust ==1 || filedata[i].ismust ==1) && !filedata[i].data){
			scope.message(filedata[i].title +'-不能为空！','error');
			return false
		}
		if(filedata[i].type ==8 && (filedata[i].ismust ==1 || filedata[i].ismust ==1)){
			if(!(str.test(filedata[i].data))){
			  scope.message("请输入正确的手机号码！",'error')
			   return false;
			}
		}
		if(filedata[i].type ==9 && (filedata[i].ismust ==1 || filedata[i].ismust ==1)){
			if(!(stremail.test(filedata[i].data))){
			  scope.message("请输入正确的邮箱！",'error')
			   return false;
			}
		}
	}
	scope.post_json(post_url,post,function(result){
		scope.message('提交成功！','success',post.success_url);
	});
}
</script>